package com.zbf.t123;

import com.alibaba.excel.EasyExcel;
import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class Test123 {

    //1构建OKHttpClient客户端
    public static OkHttpClient okHttpClient = new OkHttpClient.Builder()
            //发请求给对方传递数据的超时时间
            .writeTimeout(100, TimeUnit.SECONDS)
            //接收请求返回的数据的超时时间(适合于对方服务器处理业务时间比较长的场景)
            .readTimeout(5, TimeUnit.SECONDS)
            //链接的超时时间
            .connectTimeout(100, TimeUnit.SECONDS)
            //等待创建请求的超时时间
            .callTimeout(100, TimeUnit.SECONDS)
            .connectionPool(new ConnectionPool(100,100,TimeUnit.SECONDS))
            .build();


    public static void main(String[] args) throws IOException {
/*

        String filePath="C:\\Users\\lenovo\\Desktop\\445.xlsx";

        EasyExcel.read(filePath, TTT.class, new TesttListeneer()).sheet(0).sheetName("全国视频发布").headRowNumber(2).doRead();
*/


        //2 构建请求
        Request request = new Request.Builder()
                //你要访问的对方的服务器的地址
                .url("https://v.douyin.com/dYFKu8q/")
                //请求方式 GET
                .get()
                //添加请求头信息
                .addHeader("token", "11233456789")
                .build();

        //3、发送请求
        Response execute = okHttpClient.newCall(request).execute();

        System.out.println(execute.request().url().url().toString());;

    }
}
